import { defineStore } from 'pinia'

export const usePostDetailStore = defineStore('postDetail', {
  state: () => ({
    toId: undefined,
    toUid: undefined,
    toUserName: '请输入评论内容',
    toRemainPid: undefined,
  }),
  actions: {
    setToId(toId) {
      this.toId = toId
    },
    setToUid(toUid) {
      this.toUid = toUid
    },
    setToUserName(toUserName) {
      this.toUserName = `回复 ${toUserName}:`
    },
    setToRemainPid(toRemainPid) {
      this.toRemainPid = toRemainPid
    },

    reset() {
      this.toId = undefined
      this.toUid = undefined
      this.toRemainPid = undefined
      this.toUserName = '请输入评论内容'
    },
  },
})
